#include<iostream>
#include<vector>
using namespace std;
vector<vector<int>> ret;
vector<int> path;
void dfs(vector<int>& v,int pos)
{
	ret.push_back(path);
	if (path.size() == v.size())
	{
		return;
	}

	for (int i = pos; i < v.size(); i++)
	{
		path.push_back(v[i]);
		dfs(v, i + 1);
		path.pop_back();
	}
}


int main()
{
	vector<int> v = { 1,2,3 };
	dfs(v,0);
	for (int i = 0; i < ret.size(); i++)
	{
		for (int j = 0; j < ret[i].size(); j++)
		{
			cout << ret[i][j] << " ";
		}
		cout << endl;
	}
}